﻿using WpfApplication6.Model;

namespace WpfApplication6.ViewModel
{
    [ShellCommand]
    public class ShowProductsViewModel : CommandViewModel
    {
        private readonly IProductsRepository _repository;
        private readonly IShell _shell;

        public ShowProductsViewModel(IShell shell, IProductsRepository repository)
        {
            _shell = shell;
            _repository = repository;
            DisplayText = "Show Products";
        }

        protected override void Execute()
        {
            _shell.MainPanel = new ProductsViewModel(_repository) {DisplayText = "Products"};
        }

        protected override bool CanExecute()
        {
            return true;
        }
    }
}